package com.example.xiaoshuo_yudu.controller;
import com.example.xiaoshuo_yudu.entity.Result;
import com.example.xiaoshuo_yudu.entity.entity.News;
import com.example.xiaoshuo_yudu.service.NewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 新闻信息表 前端控制器
 * </p>
 *
 * @author xusen
 * @since 2025-07-24
 */
@RestController
@RequestMapping("/api/news")
public class NewsController {
    @Autowired
    private NewsService newsService;
    @GetMapping("/getNews")
    public Result<List<News>> get() {
        List<News> news =newsService.get();
        return Result.success(news);
    }

}
